@import "shared";

// ----------------------------------------------------------------------------
// @private css3-feature-support variables must always include a list of five boolean values
// representing in order: -moz, -webkit, -o, -ms, -khtml
$box-shadow-support: -moz, -webkit, not -o, not -ms, not -khtml;

// @doc off
// These defaults make the arguments optional for this mixin
// If you like, set different defaults before importing.
// @doc on

// ----------------------------------------------------------------------------
// Defaults

// The default color for box shadows
$default-box-shadow-color: #333333 !default;

// The default horizontal offset. Positive is to the right.
$default-box-shadow-h-offset: 0px !default;

// The default vertical offset. Positive is down.
$default-box-shadow-v-offset: 0px !default;

// The default blur length.
$default-box-shadow-blur: 5px !default;

// The default spread length.
$default-box-shadow-spread : false !default;

// The default shadow inset: inset or false (for standard shadow).
$default-box-shadow-inset : false !default;

// ----------------------------------------------------------------------------
// Mixins

// Provides cross-browser for Webkit, Gecko, and CSS3 box shadows
// when one or more box shadows are needed.
// Each shadow argument should adhere to the standard css3 syntax
// for the box-shadow property.
@mixin box-shadow($shadow...) {
  $default: -compass-space-list(compact(if($default-box-shadow-inset, inset, false), $default-box-shadow-h-offset, $default-box-shadow-v-offset, $default-box-shadow-blur, $default-box-shadow-spread, $default-box-shadow-color));
  $shadow: set-arglist-default($shadow, $default);
  @include experimental(box-shadow, $shadow, $box-shadow-support...);
}

// Provides a single cross-browser CSS box shadow for Webkit, Gecko, and CSS3.
// Includes default arguments for color, horizontal offset, vertical offset, blur length, spread length, and inset.
@mixin single-box-shadow(
  $hoff   : $default-box-shadow-h-offset,
  $voff   : $default-box-shadow-v-offset,
  $blur   : $default-box-shadow-blur,
  $spread : $default-box-shadow-spread,
  $color  : $default-box-shadow-color,
  $inset  : $default-box-shadow-inset
) {
  @if not ($inset == true or $inset == false or $inset == inset) {
    @warn "$inset expected to be true or the inset keyword. Got #{$inset} instead. Using: inset";
  }

  @if $hoff == none {
    @include box-shadow(none);
  } @else {
    $full   : $hoff $voff;
    @if $blur   { $full: $full $blur;   }
    @if $spread { $full: $full $spread; }
    @if $color  { $full: $full $color;  }
    @if $inset  { $full: inset $full;   }
    @include box-shadow($full);
  }
}
